import request from '@/utils/request'

// 验证码 登录接口
export const userLoginService = ({ phone, code }) =>
  request.post('/user/login', { phone, code })

// 密码 登录接口
export const userPwdLoginService = ({ phone, password }) =>
  request.post('/user/loginPwd', { phone, password })

// 获取用户基本信息
export const userGetInfoService = () => request.get('/user/me')

// 更新用户基本信息
export const userUpdateInfoService = ({ id, uername, sex, biryhday }) =>
  request.put('/user/update', { id, uername, sex, biryhday })

// 更新用户头像
export const userUpdateAvatarService = (avatar) =>
  request.post('/user/upload', avatar, {
    headers: {
      //文件上传的类型
      'Content-Type': 'multipart/form-data'
    }
  })

// 更新用户密码
export const userUpdatePasswordService = ({ old_pwd, new_pwd, re_pwd }) =>
  request.patch('/my/updatepwd', { old_pwd, new_pwd, re_pwd })
